home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / wndwc20.zip / WNDWC20.H < prev    next >
Text File  |  1989-03-06  |  17KB  |  449 lines

  1. /*==========================================================================*\
  2. | WNDWC20.H - header file for WNDWC20                                        |
  3. |                                                                            |
  4. |    This header file contains external declarations for the variables in    |
  5. | WC20VAR.C.  It also contains the macros, enums, and typedefs used by       |
  6. | the WNDWC modules.  If you change this file, it will not affect the        |
  7. | WNDWC modules in the library (.LIB) file, unless you recompile the         |
  8. | source code.  See the documentation for information about registering      |
  9. | for the source code.                                                       |
  10. |                                                                            |
  11. |   Copyright (C) 1989 by James H. LeMay,  All rights reserved.              |
  12. |   Conversion to Turbo C by Jordan Gallagher / Wisdom Research              |
  13. \*==========================================================================*/
  14.  
  15. #if !defined(egainfo) && !defined(egarows)
  16.  
  17. #include "qwikc20.h"                      /* auto-include if not included */
  18.  
  19. #endif
  20.  
  21. /* If you leave this macro undefined, it will save data space and about 2.5k
  22.    of code.  Comment out the line below, and recompile the source code,
  23.    if you are using only video page 0.
  24. */
  25. #define MULTIPAGE
  26.  
  27. /* If you are NOT using virtual windows, comment out the line below and
  28.    recompile the source code.
  29. */
  30. #define ADDVIRTUAL
  31.  
  32. #define NOSHADOW 0x0000
  33. #define BOTHSHADOWS 0x000C   /* SHADOWLEFT+SHADOWRIGHT */
  34. #define WRITETOMASK 0x7000   /* 01110000b - (To mask out writeto modes) */
  35.  
  36. /* Change these to suit your data needs. */
  37. #define MAXWINDOW  5          /* 1-254 : windows per video page */
  38. #define MAXVIRTUALWINDOW  2   /* 0-254 : total number of virtual windows-1 */
  39. #define MAXPAGEUSED  1        /* 0-maxpage : top video page number,
  40.                                  usually 0.  This can be greater than an
  41.                                  expected maxpage.
  42.                               */
  43.  
  44. /* Place all of your window names needed for random-access here: */
  45. enum windownames {
  46.     WINDOW0,                  /* Reserved for the non-window area. */
  47.     WINDOW1,
  48.     WINDOW2,
  49.     WINDOW3,
  50.     WINDOW4,
  51.     WINDOW5,
  52.     AWINDOW,                  /* A name for non-unique windows. */
  53.     FREEWINDOW                /* Reserved for a freed virtual windows stat. */
  54. };
  55.  
  56. enum borders {
  57.     BLANK_BORDER,
  58.     SINGLE_BORDER,
  59.     DOUBLE_BORDER,
  60.     HDOUBLE_BORDER,
  61.     VDOUBLE_BORDER,
  62.     SOLID_BORDER,
  63.     EVEN_SOLID_BORDER,
  64.     THIN_SOLID_BORDER_1,
  65.     THIN_SOLID_BORDER_2,
  66.     LHATCH_BORDER,
  67.     MHATCH_BORDER,
  68.     HHATCH_BORDER,
  69.     USER_BORDER_1,
  70.     USER_BORDER_2,
  71.     NO_BORDER = 255
  72. };
  73.  
  74. enum brdrparts {
  75.     BRDR_TL,
  76.     BRDR_TH,
  77.     BRDR_TR,
  78.     BRDR_LV,
  79.     BRDR_RV,
  80.     BRDR_BL,
  81.     BRDR_BH,
  82.     BRDR_BR,
  83.     BRDR_LT,
  84.     BRDR_HL,
  85.     BRDR_RT,
  86.     BRDR_TT,
  87.     BRDR_VL,
  88.     BRDR_BT,
  89.     BRDR_CL
  90. };
  91.  
  92. enum brdracronyms {
  93.     TL, TH, TR, LV, RV, BL, BH, BR, LT, HL, RT, TT, VL, BT, CL
  94.  
  95. /*        The first letters of the border acronyms mean:
  96.             T = top or tee  B = bottom
  97.             V = vertical    H = horiz
  98.             L = left        R = right
  99.             P = partition   C = cross
  100.           The second letter is the same except for:
  101.             T = tee         L = line
  102.           Here they are in their relative positions:
  103.             TL  TH  TT  TH  TR
  104.             LV      VL      RV
  105.             LT  HL  CL  HL  RT
  106.             LV      VL      RV
  107.             BL  BH  BT  BH  BR
  108. */
  109.  
  110. };
  111.  
  112. typedef char brdr_t[ BRDR_CL + 2 ];
  113.  
  114. enum dir_t {
  115.     NO_DIR, UP, DOWN, VERY_TOP, TOP, BOTTOM, VERY_BOTTOM, FAR_LEFT, LEFT,
  116.     RIGHT, FAR_RIGHT, CENTER, HORIZONTAL, VERTICAL
  117. };
  118.  
  119. typedef struct {
  120.     unsigned char wsrow, wscol, wsrows,
  121.                   wscols, wsrow2, wscol2;     /* window w/border */
  122.     unsigned char wrow, wcol, wrows, wcols,
  123.              wrow2, wcol2;                    /* window only */
  124.     int wndwattr, brdrattr, origattr;         /* original window attribute */
  125.     int wsbrdr, wsline;
  126.     int wsname;                               /* see windownames enum */
  127.     unsigned char wswherer, wswherec;         /* window-relative */
  128.     int wsmodes;
  129.     int wscursor;                             /* cursor mode for the window */
  130.     unsigned char ulcol, ulcols, ulrows;      /* peculiar underlay location */
  131.     int ulbytes;                              /* size in bytes for underlay */
  132.     int far *ulptr;                           /* for underlay */
  133.     vscr_t vscr;                              /* screen stats for qwik */
  134.     unsigned char refrow, refcol;             /* viewed corner in virtual wndw
  135.                                                  or original wsrow & wscol for
  136.                                                  hidden window */
  137.     int viewbrdr;                             /* border viewed on the CRT */
  138.     int vi;                                   /* virtual level index */
  139. } wndwstat_t;
  140.  
  141. typedef struct {
  142.     int linewi;
  143.     int lineli;
  144.     int overlaplength;
  145. } linearray_t;
  146.  
  147. typedef struct {                   /* Area of union between two windows */
  148.     linearray_t rowline, colline;
  149. } unioncoord_t;
  150.  
  151. #define ucrowwi rowline.linewi
  152. #define ucrowli rowline.lineli
  153. #define ucrows rowline.overlaplength
  154. #define uccolwi colline.linewi
  155. #define uccolli colline.lineli
  156. #define uccols colline.overlaplength
  157.  
  158. typedef unioncoord_t ucrarray_t[ MAXWINDOW+1 ];
  159.  
  160. typedef wndwstat_t wndwstats_t[ MAXWINDOW+1 ];
  161.  
  162. /* Margins for limiting movement with movewindow or vresizewindow */
  163. typedef struct {
  164.     unsigned char left_margin, right_margin, top_margin, bottom_margin;
  165. } margin_t;
  166.  
  167. #ifndef __WC20VAR__          /* don't process this code if in WC20VAR.C */
  168.  
  169. extern brdr_t brdr[ USER_BORDER_2 ];
  170.  
  171. #endif
  172.  
  173. /* valid modes for setwindowmodes() */
  174. #define RELMODE 0x0001       /* bit 0 - Window relative; temporary stats */
  175. #define PERMMODE 0x0002      /* bit 1 - Can't be moved or removed, no underlay
  176.                               */
  177. #define SHADOWLEFT 0x0004    /* bit 2 - Shadow on the left side */
  178. #define SHADOWRIGHT 0x0008   /* bit 3 - Shadow on the right side */
  179. #define ZOOMMODE 0x0010      /* bit 4 - Zoom effect on make and accesswindow */
  180. #define HIDDENMODE 0x0020    /* bit 5 - Create window while hidden */
  181. #define VIRTUALMODE 0x0040   /* bit 6 - Create Virtual window as well */
  182. #define CURSOROFFMODE 0x0080 /* bit 7 - Leave cursor off at all times */
  183. #define SEETHRUMODE 0x0100   /* bit 8 - Doesn't clear screen inside window */
  184. #define NOHIDEMODE 0x0200    /* bit 9 - Ignores request to hide window */
  185. #define NOACCESSMODE 0x0400  /* bit 10 - Ignores request to access window */
  186. #define NOMOVEMODE 0x0800    /* bit 11 - Ignores request to move/resize window
  187.                               */
  188.  
  189. /* Other modes for program detection: */
  190. #define TOCRTMODE 0x1000       /* bit 12 - Writing to CRT */
  191. #define TOHIDDENMODE 0x2000    /* bit 13 - Writing to Hidden window */
  192. #define TOVIRTUALMODE 0x4000   /* bit 14 - Writing to Virtual window */
  193.  
  194.  
  195. #ifndef __WC20VAR__           /* don't process this code if in WC20VAR.C */
  196.  
  197. #ifdef ADDVIRTUAL
  198. extern unsigned char startproc;   /* Originating function executing
  199.                                      viewuncovered */
  200. extern int startmodes;            /* Original writeto mode */
  201. #endif
  202.  
  203. extern int shadowcolor;
  204. extern char shadowchar;
  205. extern unsigned char titleofs;  /* # of cols title placed offset from
  206.                                    border */
  207.  
  208. /* Flags corresponding to the above modes.  Automatically set for the
  209.    window you are in.
  210. */
  211. extern char relflag, permflag, zoomflag, hiddenflag, virtualflag;
  212. extern char cursoroff_flag, seethruflag, nohideflag, noaccessflag, nomoveflag;
  213. extern char tocrtflag, tohiddenflag, tovirtualflag;
  214.  
  215. extern wndwstats_t wndwstat;
  216. extern wndwstat_t tws;           /* Window stats on the top Level Index */
  217. #define topwndwstat tws          /* another name for it - more verbose */
  218.  
  219. #ifdef ADDVIRTUAL
  220. extern wndwstat_t tvs;          /* Optional virtual stats for top window. */
  221. #define topvirtualstat tvs      /* another name for it - more verbose */
  222. #endif
  223.  
  224. extern int li;              /* Top level index */
  225. extern int hli;             /* Hidden level index */
  226. extern int wi;              /* Window index to save top stat (HLI or LI) */
  227. extern unsigned char pli;   /* Permanent window level index */
  228. extern int cursordefault;   /* Default cursor mode for each window */
  229. extern int windowmodes;     /* Logical sum of all window modes listed above */
  230. extern margin_t margins;    /* Limits for moving or resizing windows */
  231.  
  232. #endif
  233.  
  234.  
  235. typedef struct {
  236.     wndwstats_t pagews;        /* equivalent to wndwstat */
  237.     wndwstat_t pagetws;        /* equivalent to topwndwstat */
  238.  
  239. #ifdef ADDVIRTUAL
  240.     wndwstat_t pagetvs;        /* equivalent to topvirtualstat */
  241. #endif
  242.  
  243.     int pageli;             /* equivalent to li */
  244.     int pagehli;            /* equivalent to hli */
  245.     int pagewi;             /* equivalent to wi */
  246.     unsigned char pagepli;  /* equivalent to pli */
  247.     int pagecursor;
  248.     int pagemodes;          /* equivalent to windowmodes */
  249.     margin_t pagemargins;   /* equivalent to margins */
  250. } pagestat_t;
  251.  
  252.  
  253. #ifndef __WC20VAR__          /* don't process this code if in WC20VAR.C */
  254.  
  255. #ifdef MULTIPAGE
  256. extern pagestat_t far *pagestat;
  257. #endif
  258.  
  259. #ifdef ADDVIRTUAL
  260. extern wndwstat_t far *virtualstat;
  261. extern unsigned char virtualrows;   /* Default rows for virtual screen. */
  262. extern unsigned char virtualcols;   /* Default cols for virtual screen. */
  263. extern unsigned int virtualsize;    /* virtualcols * (virtualrow+2) * 2 */
  264. #endif
  265.  
  266. extern char maxvalidpage;  /* The lesser of maxpage or MAXPAGEUSED */
  267. extern char zoomdelay;     /* Delay in ms between each qbox for zoom effect */
  268. extern char prefer_multitask;   /* Flag set when multitasking compatibility
  269.                                    is preferred
  270.                                 */
  271.  
  272. /* For compatibility with Pascal versions, callgoof is implemented as a macro
  273.    which provides a simple call to showgoof.
  274. */
  275. #define callgoof(errornum) showgoof(errornum)
  276.  
  277. /*  ----------   Prototypes from WNDWC20.C   -----------  */
  278.  
  279. int heapok( unsigned long numbytes );
  280. void setrowsandcolsat( unsigned char row, unsigned char col );
  281. int getflag( int mode, int modes );
  282. void getflags( int modes );
  283. void saveqeosofs(void);
  284. void setqeosofs(void);
  285. void saveqscr(void);
  286. void setqscr(void);
  287. void gettopwndwstatat( unsigned i );
  288. void savetopwndwstatat( unsigned i );
  289. void savetoppagestatat( unsigned i );
  290. void gettoppagestatat( unsigned i );
  291. void savevirtualstat(void);
  292. void savecursordata(void);
  293. void saveanywndwstat(void);
  294. void getunderlayat( void far *theul );
  295. void saveunderlayat( void far *theul );
  296. void writetotop(void);
  297. void check_zenith(void);
  298. void checkmultitask(void);
  299. void initpages( char clearscr );
  300. void initwindow( int wattr, int clearscr, char cursorok );
  301. void setcursordefault( int cursormode );
  302. void setwindowmodes( int sumofmodes );
  303. void qbox( unsigned char row, unsigned char col, unsigned char rows,
  304.            unsigned char cols, char clearscr );
  305. void zoomqbox(void);
  306. void shadowfill( unsigned char vertcol, unsigned char horizcol );
  307. void addshadow(void);
  308. void adjustmodes( int *writetomode, int *modes );
  309. void setulsize( int rows, int cols, int *tempulbytes );
  310. void selfcenter( unsigned char *row, unsigned char *col,
  311.                  unsigned char rows, unsigned char cols );
  312. int getnextvi(void);
  313. void makevirtualwindow( int *modes );
  314. void makehiddenwindow( unsigned char row, unsigned char col,
  315.                        unsigned char rows, unsigned char cols, int modes );
  316. void makecrtwindow( unsigned char row, unsigned char col, unsigned char rows,
  317.                     unsigned char cols, int modes, int writetomode );
  318. void makewindow( unsigned char row, unsigned char col, unsigned char rows,
  319.                  unsigned char cols, int wattr, int battr, int brdrsel,
  320.                  int windowname );
  321. unsigned char gettitlerow( int toporbottom );
  322. void titlewindow( int toporbottom, int justify, int titleattr, char *title );
  323. void locatecursor(void);
  324. void restoretcwindow(void);
  325. void restorestat( int writetomodes );
  326. void removewindow(void);
  327.  
  328. /*  ----------   Prototypes from WC20COM.C   -----------  */
  329.  
  330. void getstatfor( int windowname, int mode );
  331. void windunion( int lcornerwi, int lengthwi, int lcornerli, int lengthli,
  332.                 linearray_t *lineofchars );
  333. void unionmap( wndwstat_t *wsli, char far *mapptr, unioncoord_t *ucr, int li,
  334.                char update );
  335. void modupperunderlays( int far *tempolptr, char far *mapptr,
  336.                         unioncoord_t *ucrs, int update );
  337.  
  338. /*  ----------   Prototypes from WC20WIN.C   -----------  */
  339.  
  340. void wwrite( unsigned char row, unsigned char col, char *astr );
  341. void wwritec( unsigned char row, char *astr );
  342. void wwrite_sub( unsigned char row, unsigned char col, int length,
  343.                  char far *astr );
  344. void wgotorc( unsigned char row, unsigned char col );
  345. void wgotoeos(void);
  346. void weostorc( unsigned char row, unsigned char col );
  347. unsigned char wwherer(void);
  348. unsigned char wwherec(void);
  349. unsigned char weosr(void);
  350. unsigned char weosc(void);
  351. void wbrdrh( unsigned char row );
  352. void wbrdrv( unsigned char col );
  353. void wbrdrpart( unsigned char row, unsigned char col, int part );
  354. void wlineh( unsigned char row, unsigned char col, unsigned char cols );
  355. void wlinev( unsigned char row, unsigned char col, unsigned char rows );
  356. void wlinepart( unsigned char row, unsigned char col, int part );
  357. void scroll( unsigned char toprow, int dir );
  358. void wscrollup(void);
  359. void wscrolldown(void);
  360. void winsline(unsigned char row);
  361. void wdelline(unsigned char row);
  362. void clrfield( unsigned char cols, int attr );
  363. void wclrfield( unsigned char row, unsigned char col, unsigned char cols,
  364.                 int attr );
  365. void wclrline( unsigned char row );
  366. void wclreol( unsigned char row, unsigned char col, int attr );
  367. void wclreos( int attr );
  368. void wclrfieldeos( unsigned char cols, int attr );
  369. void wclrtitle( int toporbottom );
  370. void wclrscr(void);
  371.  
  372. /*  ----------   Prototypes from WC20VIR.C   -----------  */
  373.  
  374. void setvirtualsize( unsigned char rows, unsigned char cols );
  375. void writetovirtual( int windowname );
  376. void vviewrc( unsigned char row, unsigned char col );
  377. void vviewrcrel( int numofrows, int numofcols );
  378. void updateview( int far *tempolptr, int far *tempviewptr, int doupdate,
  379.                  char far *mapptr, int mapbytes  );
  380. void vupdatecoveredwindow( char doupdate );
  381. void restorewriteto( char func );
  382. int viewuncovered( char proc );
  383. void vupdateview(void);
  384. void vupdatetitles(void);
  385. void vupdatecursor(void);
  386. void vupdaterows( unsigned char row, unsigned char rows );
  387. void vupdateviewandtitles(void);
  388. void vupdatewindow(void);
  389. void vscrollview( int numofrows, int numofcols );
  390. void vresizewindow( int numofrows, int numofcols );
  391. void vzoomwindow(void);
  392.  
  393. /*  ----------   Prototypes from WC20MGR.C   -----------  */
  394.  
  395. void writetocrt(void);
  396. void writetohidden( int windowname );
  397. void writetopage( char pagenum );
  398. void writeandviewpage( char pagenum );
  399. void hidewindow(void);
  400. void show( int sli );
  401. void showwindow( int windowname );
  402. void accountforshadow( int far *tempulptr, int far *tempolptr );
  403. void movewindow( int numofrows, int numofcols );
  404. int getlevelindex( int windowname );
  405. void swapunderlaydata( int far *tempulptr, int far *tempolptr,
  406.                        char far *mapptr, int mapbytes );
  407. void accesswindow( int windowname );
  408. void replaceline( int index, unsigned char lastindex, int part, int oldbrdr,
  409.                   int *abrdr, int newbrdr );
  410. void changerow( unsigned char row, int parth, int parttee, int oldbrdr,
  411.                 int *abrdr, int newbrdr );
  412. void changecol( unsigned char col, int partt, int partv, int partb,
  413.                 int parttee, int oldbrdr, int *abrdr, int newbrdr );
  414. void changeborder( int newbrdr );
  415. void restoreborder(void);
  416.  
  417. /*  ----------   Prototypes from SCANBRDR.C   -----------  */
  418.  
  419. void scanbrdr( void far *start, int numtoscan, int charattr, int far *offset,
  420.                int far *matchcount );
  421.  
  422. /*  ----------   Prototypes from SCANMAP.C   -----------  */
  423.  
  424. void scanmap( void far *mappoint, int numtoscan, char levelindex,
  425.               int far *offset, int far *matchcount );
  426.  
  427. /*  ----------   Prototypes from SWAPI.C   -----------  */
  428.  
  429. void swapi( int far *array1, int far *array2, int count );
  430.  
  431. /*  ----------   Prototypes from MOVE16.C   -----------  */
  432.  
  433. void move16( void far *source, void far *dest, int numofbytes );
  434.  
  435. /*  ----------   Prototypes from MOVEWORD.C   -----------  */
  436.  
  437. void movewords( int far *source, int far *dest, int numofwords );
  438.  
  439. /*  ----------   Prototypes from FILL16.C   -----------  */
  440.  
  441. void fill16( void far *dest, int count, char achar );
  442.  
  443. /*  ----------   Prototypes from GOOF.C   -----------  */
  444.  
  445. void showgoof( char errornum );
  446.  
  447. #endif                   /* not processed if in WC20VAR */
  448.  
  449.